<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;

        //执行一个laydate实例
        laydate.render({
            elem: '#date1', //指定元素
            type: 'datetime'
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#date2', //指定元素
            type: 'datetime'
        });

        //监听提交
        form.on('submit(formSub)', function(data){
            if (data.field.date1.length<=0){
                layer.msg('起始日期必填',{icon:2});
                return false;
            }else if (data.field.date2.length<=0){
                layer.msg('截止日期必填',{icon:2});
                return false;
            }
        });
    });
</script>